package com.banca2.bracketplant.pojo;

import com.banca2.bracketplant.common.RequestType;
import com.banca2.bracketplant.communicate.BcnResponseProcessor;

/*********************************************************************<br>
 * BncRequest.java													 *<br>
 * 功 能：				 												 *<br>
 * 																	 *<br>
 *  Ver   变更日期        负责人  					变更内容                        			 *<br>
 * ───────────────────────────────────────────────────────────────── *<br>
 * V0.01 2015-6-1	ZQ      				    创建					 *<br>
 * 																	 *<br>
 * Copyright (c) 2015 StarFollower Corporation. All rights reserved. *<br>
 *┌─────────────────────────────────────────────────────────────────┐*<br>
 *│　此技术信息为本团队机密信息，未经本团队书面同意禁止向第三方披露．　				│*<br>
 *│　版权所有：StarFollower　　　　　　　　　　                     　					│*<br>
 *└─────────────────────────────────────────────────────────────────┘*<br>
 *********************************************************************/
public class BncRequest {
	
	// 方法类型：true-POST；false-GET
	private boolean isPost;
	
	// 请求的类型，即URL的“文件名”部分
	private RequestType requestType;
	
	// 请求参数
	private Object params;
	
	// 处理服务器响应的回调对象
	private BcnResponseProcessor processor;

	public BncRequest() {
	}

	public BncRequest(boolean isPost, RequestType requestType, Object params,
			BcnResponseProcessor processor) {
		super();
		this.isPost = isPost;
		this.requestType = requestType;
		this.params = params;
		this.processor = processor;
	}

	@Override
	public String toString() {
		return "BncRequest [isPost=" + isPost + ", requestType=" + requestType
				+ ", params=" + params + ", processor=" + processor + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (isPost ? 1231 : 1237);
		result = prime * result + ((params == null) ? 0 : params.hashCode());
		result = prime * result
				+ ((processor == null) ? 0 : processor.hashCode());
		result = prime * result
				+ ((requestType == null) ? 0 : requestType.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BncRequest other = (BncRequest) obj;
		if (isPost != other.isPost)
			return false;
		if (params == null) {
			if (other.params != null)
				return false;
		} else if (!params.equals(other.params))
			return false;
		if (processor == null) {
			if (other.processor != null)
				return false;
		} else if (!processor.equals(other.processor))
			return false;
		if (requestType != other.requestType)
			return false;
		return true;
	}

	public boolean isPost() {
		return isPost;
	}

	public void setPost(boolean isPost) {
		this.isPost = isPost;
	}

	public RequestType getRequestType() {
		return requestType;
	}

	public void setRequestType(RequestType requestType) {
		this.requestType = requestType;
	}

	public Object getParams() {
		return params;
	}

	public void setParams(Object params) {
		this.params = params;
	}

	public BcnResponseProcessor getProcessor() {
		return processor;
	}

	public void setProcessor(BcnResponseProcessor processor) {
		this.processor = processor;
	}

}
